// Package main.
// creator 2022-02-25 03:26:37
// Author  zhenxinma.
package main

import (
	"fmt"
	"github.com/lucas-clemente/quic-go/http3"
	"net/http"
)

func main() {
	http.HandleFunc("/grpc", myHandler)
	//http.ListenAndServe("127.0.0.1:8000", nil)
	http3.ListenAndServeQUIC("localhost:9999", "/path/to/cert/chain.pem", "/path/to/privkey.pem", nil)
}

func myHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Println(r.RemoteAddr, "连接成功")
	// 请求方式：GET POST DELETE PUT UPDATE
	fmt.Println("method:", r.Method)
	// /go
	fmt.Println("url:", r.URL.Path)
	fmt.Println("header:", r.Header)
	fmt.Println("body:", r.Body)
	// 回复
	w.Write([]byte("www.5lmh.com"))
}
